

package com.maoshi.shop.discount.platform.controller;

import com.maoshi.shop.discount.comment.model.DiscountProd;
import com.maoshi.shop.discount.comment.service.DiscountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 *
 * @author lgh on 2018/11/21.
 */
@RestController
@RequestMapping("/platform/discountProd")
public class DiscountProdController {

    @Autowired
    private DiscountService discountService;


    /**
	 * 获取信息
	 */
	@GetMapping("/info/{discountId}")
	public ResponseEntity<List<DiscountProd>> info(@PathVariable("discountId") Long discountId){

		List<DiscountProd> discountProds = discountService.getDiscountAndItemAndProdById(discountId).getDiscountProds();
		return ResponseEntity.ok(discountProds);
	}

}
